package frame.options.simulation.results.virtual.graphical;

import javax.swing.Icon;

import model.components.nodes.node.Node;
import model.components.nodes.node.sdn.SdnNode;
import model.components.nodes.node.virtual.VirtualNode;

import org.apache.commons.collections15.Transformer;

public class VirtualNodeIconTransformer implements Transformer< Node, Icon >
{
	@Override
	public Icon transform( Node node )
	{
		SdnNode nodeSubstrate = ( ( VirtualNode )node ).getSdnNode();
		
		if( node.isSelected() )
			return node.getGreenIcon();
		
		else if( !node.isSelected() && nodeSubstrate != null )
			return node.getYellowIcon();
		
		return node.getGreyIcon();
	}

}
